<?php
require_once ("View/loginview.php");
require_once ("View/EventView.php");
class EventController {

	public function EventController() {
		$Stringer = "";
		$LoginView = New LoginView();
		$EventView = New EventView();
		$LoginHandler = New LoginHandler();
		$EventHandler = new EventHandler();
	
		if ($LoginView -> TriedToGoToEvent()) {
			$Stringer = $EventView -> EventBox($EventHandler -> ListEventDB());
			$Stringer .= $EventView -> ApplyToEvent();
		}
		if ($EventView -> TriedToEvent()) {
			
			$EventHandler->DoAddToEvent($LoginHandler->GetLoginUser(),$EventView->GetFirstName(), $EventView->GetLastName());
			$Stringer .= $EventView->DeleteFromEvent();
			
		}
		if ($EventView->TriedToDelete()){
			var_dump("här");
			var_dump($LoginHandler->GetLoginUser());
			$EventHandler->DeleteFromEvent($LoginHandler->GetLoginUser());
			
		}
		
		return $Stringer;
	}

}
